<!DOCTYPE html>
<html>

<head lang='zh'>
	<meta charset='utf-8'>
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="renderer" content="webkit" />
	<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=0" />
	<title>Luckysheet</title>

	<link rel='stylesheet' href='./plugins/css/pluginsCss.css' />
	<link rel='stylesheet' href='./plugins/plugins.css' />
	<link rel='stylesheet' href='./css/luckysheet.css' />
	<link rel='stylesheet' href='./assets/iconfont/iconfont.css' />
	<link rel='stylesheet' href='./assets/iconfont2/iconfont.css' />
	
	<!-- // nby 新增“年月” -->
	<link rel="stylesheet" href="./assets/monthSelect/style.css">


	<script src="./plugins/js/plugin.js"></script>

	<!-- rollup luckysheet.js -->
	<script src="./luckysheet.umd.js"></script>

	<link rel="stylesheet" href="./assets/viewer/viewer.min.css">
	<script src="./assets/viewer/viewer.min.js"></script>
	<style>
/* .numInput.flatpickr-minute{
	-webkit-touch-callout:none; 
	-webkit-user-select:none; 
	-moz-user-select:none;
	-ms-user-select:none; 
	user-select:none;
} */

body{
	overflow: hidden!important;
}
.superScript{
  position: relative;
  top: -3px;
  display: inline-block;
  transform: scale(.8);
}
.subScript{
  position: relative;
  bottom: -3px;
  display: inline-block;
  transform: scale(.8);
}

#mySaixuanDiv:hover #myAsc {
  border-right: 1px solid #CFCFD1 !important;
}


#importConDiv:hover #luckysheet-icon-import {
  border-right: 1px solid #CFCFD1 !important;
}

#luckysheet-icon-fmt-other:hover .luckysheet-toolbar-menu-button-caption {
  border-right: 1px solid #CFCFD1 !important;
}

#luckysheet-icon-font-family:hover .luckysheet-toolbar-menu-button-caption {
  border-right: 1px solid #CFCFD1 !important;
}

#luckysheet-icon-font-size:hover .luckysheet-toolbar-combo-button-caption {
  border-right: 1px solid #CFCFD1 !important;
}

#luckysheet-icon-postil:hover .luckysheet-toolbar-menu-button-caption {
  border-right: 1px solid #CFCFD1 !important;
}

#luckysheet-icon-conditionformat:hover #right_conditionformat {
  border-right: 1px solid #CFCFD1 !important;
}

#luckysheet-icon-seachmore:hover #left_seachmore {
  border-right: 1px solid #CFCFD1 !important;
}

		

		
		/* nby 隐藏底部两块按钮 */
		/* .luckysheet-stat-area,#luckysheet-sheet-area{
	display: none!important;
}
.luckysheet-grid-window{
background-color: white!important;
} */

		/* nby 隐藏底部两块按钮  END */




		/* .luckysheet-postil-show{
			display: none!important;
		}

		#luckysheet-postil-showBoxs{
			display: none!important;
		
		} */

	</style>
</head>

<body>

	<div id="luckysheet22" style="position:absolute;width:100%;height:100%;left: 0px;top: 0px;"></div>
	<iframe src="./assets/chromePrint/print.html" id="chromePrintIframe" style="position: absolute;left: -400px;top: -400px;" frameborder="0"></iframe>

	<div id="btn"
		style='z-index:999;background-color: red;width: 60px;height: 60px;position: fixed;cursor: pointer;bottom: 80px;left: 30px;'>
		测试</div>


	<script src="./demoData/demoFeature.js"></script>
	<script src="./demoData/sheetFormula.js"></script>
	<script src="./demoData/sheetCell.js"></script>
	<script src="./demoData/sheetConditionFormat.js"></script>
	<script src="./demoData/sheetTable.js"></script>
	<script src="./demoData/sheetComment.js"></script>
	<script src="./demoData/sheetPivotTableData.js"></script>
	<script src="./demoData/sheetPivotTable.js"></script>
	<script src="./demoData/sheetSparkline.js"></script>
	<script src="./demoData/sheetChart.js"></script>
	<script src="./demoData/sheetPicture.js"></script>
	<script src="./demoData/sheetDataVerification.js"></script>

	<script>

		function foo(httpPath, token) {
			// 创建xhr
			const xhr = new XMLHttpRequest()

			xhr.onreadystatechange = async function () {
				if (xhr.readyState == 4) {
					

					// let xlgJson = JSON.parse(JSON.parse(xhr.responseText).result)
					// let sheetCell222 = xlgJson.content
					
          
					// let xlgJson = JSON.parse(xhr.responseText)
					// let sheetCell222 = xlgJson





					// 设置数据验证
					// luckysheet.setDataVerification({"checked":[[false,false]],"type":"check_boxs","value":[["a","b"]]})


        
			  // let sheetCell222=
  
					// let xlgJson2={"title":"上下左右角标","content":[{"name":"Sheet1","color":"","status":1,"order":0,"config":{"columnlen":{"4":30,"8":30},"customWidth":{"4":1,"8":1},"rowlen":{"7":19},"customHeight":{"7":1},},"index":0,"jfgird_select_save":[],"luckysheet_select_save":[{"left":654,"width":73,"top":140,"height":19,"left_move":654,"width_move":73,"top_move":140,"height_move":19,"row":[7,7],"column":[10,10],"row_focus":7,"column_focus":10}],"ch_width":4474,"rh_height":2080,"luckysheet_selection_range":[],"zoomRatio":1,"scrollLeft":0,"scrollTop":0,"images":{},"celldata":[{"r":2,"c":4,"v":{"v":"1","_nt":{"_rb":"1"},"ct":{"fa":"General","t":"n"},"m":"1"}},{"r":2,"c":5,"v":{"mc":{r:2,c:5,rs:1,cs:2}}},{"r":2,"c":6,"v":{"mc":{r:2,c:5}}},{"r":2,"c":8,"v":{"v":"2","_nt":{"_rb":"2"},"ct":{"fa":"General","t":"n"},"m":"2"}},{"r":8,"c":4,"v":{"v":"4","_nt":{"_rb":"4"},"ct":{"fa":"General","t":"n"},"m":"4"}},{"r":8,"c":8,"v":{"v":"3","_nt":{"_rb":"3"},"ct":{"fa":"General","t":"n"},"m":"3"}}]}]}
					// let xlgJson2={"title":"上下左右角标","content":[{"name":"Sheet1","color":"","status":1,"order":0,"config":{"merge":{"2_5":{"r":2,"c":5,"rs":2,"cs":2}},"columnlen":{"4":30,"8":30},"customWidth":{"4":1,"8":1},"rowlen":{"7":19},"customHeight":{"7":1},},"index":0,"jfgird_select_save":[],"luckysheet_select_save":[{"left":654,"width":73,"top":140,"height":19,"left_move":654,"width_move":73,"top_move":140,"height_move":19,"row":[7,7],"column":[10,10],"row_focus":7,"column_focus":10}],"ch_width":4474,"rh_height":2080,"luckysheet_selection_range":[],"zoomRatio":1,"scrollLeft":0,"scrollTop":0,"images":{},"celldata":[{"r":2,"c":4,"v":{"v":"1","_nt":{"_rb":"1"},"ct":{"fa":"General","t":"n"},"m":"1"}},{"r":2,"c":5,"v":{"mc":{r:2,c:5,rs:2,cs:2}}},{"r":2,"c":6,"v":{"mc":{r:2,c:5}}},{"r":2,"c":8,"v":{"v":"2","_nt":{"_rb":"2"},"ct":{"fa":"General","t":"n"},"m":"2"}},{"r":3,"c":5,"v":{"mc":{r:2,c:5}}},{"r":3,"c":6,"v":{"mc":{r:2,c:5}}},{"r":8,"c":4,"v":{"v":"4","_nt":{"_rb":"4"},"ct":{"fa":"General","t":"n"},"m":"4"}},{"r":8,"c":8,"v":{"v":"3","_nt":{"_rb":"3"},"ct":{"fa":"General","t":"n"},"m":"3"}}]}]}

					// let xlgJson2={"title":"上下左右角标","content":[{"name":"Sheet1","color":"","status":1,"order":0,"config":{"merge":{"2_5":{"r":2,"c":5,"rs":2,"cs":2}},"columnlen":{"4":30,"8":30},"customWidth":{"4":1,"8":1},"rowlen":{"7":19},"customHeight":{"7":1},},"index":0,"jfgird_select_save":[],"luckysheet_select_save":[{"left":654,"width":73,"top":140,"height":19,"left_move":654,"width_move":73,"top_move":140,"height_move":19,"row":[7,7],"column":[10,10],"row_focus":7,"column_focus":10}],"ch_width":4474,"rh_height":2080,"luckysheet_selection_range":[],"zoomRatio":1,"scrollLeft":0,"scrollTop":0,"images":{},"celldata":[{"r":2,"c":4,"v":{"_nt":{"_rb":"1"},e:true,"ct":{"fa":"General","t":"n"}}},{"r":2,"c":5,"v":{"mc":{r:2,c:5,rs:2,cs:2}}},{"r":2,"c":6,"v":{"mc":{r:2,c:5}}},{"r":2,"c":8,"v":{"_nt":{"_rb":"2"},"ct":{"fa":"General","t":"n"}}},{"r":3,"c":5,"v":{"mc":{r:2,c:5}}},{"r":3,"c":6,"v":{"mc":{r:2,c:5}}},{"r":8,"c":4,"v":{"_nt":{"_rb":"4"},"ct":{"fa":"General","t":"n"}}},{"r":8,"c":8,"v":{e:true,"_nt":{"_rb":"3"},"ct":{"fa":"General","t":"n"}}}]}]}
          
					// let xlgJson2={"title":"上下左右角标",
					// "content":[{"name":"Sheet1","color":"","status":1,"order":0,"config":{"merge":{"2_5":{"r":2,"c":5,"rs":2,"cs":2}},"columnlen":{"4":30,"8":30},"customWidth":{"4":1,"8":1},"rowlen":{"7":19},"customHeight":{"7":1},},"index":0,"jfgird_select_save":[],"luckysheet_select_save":[{"left":654,"width":73,"top":140,"height":19,"left_move":654,"width_move":73,"top_move":140,"height_move":19,"row":[7,7],"column":[10,10],"row_focus":7,"column_focus":10}],"ch_width":4474,"rh_height":2080,"luckysheet_selection_range":[],"zoomRatio":1,"scrollLeft":0,"scrollTop":0,"images":{},"celldata":[{"r":2,"c":4,"v":{"_nt":{"_rb":"1"},e:true,"ct":{"fa":"General","t":"n"}}},{"r":2,"c":5,"v":{"mc":{r:2,c:5,rs:2,cs:2}}},{"r":2,"c":6,"v":{"mc":{r:2,c:5}}},{"r":2,"c":8,"v":{"_nt":{"_rb":"2"},"ct":{"fa":"General","t":"n"}}},{"r":3,"c":5,"v":{"mc":{r:2,c:5}}},{"r":3,"c":6,"v":{"mc":{r:2,c:5}}},{"r":8,"c":4,"v":{"_nt":{"_rb":"4"},"ct":{"fa":"General","t":"n"}}},
					// {r:8,c:6,v:{ct:{fa:'Y.m.z',t:'d'},_nt:{age:12},e:true,fileId:4343,isDetail:true}},{r:8,c:7,v:{e:true,isDetail:true}},{"r":8,"c":8,"v":{v:"222",m:"22",isDetail:true,e:false,"_nt":{"_rb":"3"},"ct":{"fa":"General","t":"n"}}}]}]}
					// let sheetCell222 = xlgJson2.content


				let res2 = await fetch('http://localhost:3000/assets/newD/下拉.txt')
				let fieldList = await res2.json()
				let sheetCell222 = fieldList


				$(function () {
						// According to the browser language
						var lang = luckysheetDemoUtil.language() === 'zh' ? 'zh' : 'en';
						var options = null;

						options = {
								// data: [sheetCell,sheetFormula,sheetConditionFormat,sheetSparkline,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable,sheetChart,sheetPicture,sheetDataVerification,...sheetCell222],
								data: [...sheetCell222],
								showinfobar: false,
								container: 'luckysheet22',
								lang: lang,
								/* uploadImage:function(file){
									return new Promise(async (res,rej)=>{
										try{
											let formData = new FormData()
											formData.append('file',file)
											const response = await fetch('http://os-kf.gongqi.info/MIX/web/apps/gongqi.tool.onlineForm/file/uploadImg',{
												method:'post',
												headers:{
													token
												},
												body:formData
											})
											const data = await response.json()
											const content = data.content
											const prePath = 'http://os-kf.gongqi.info/osweb/MIX/appCustomClient'
											const  originUrl = prePath + content.img

											const thumbnail_base64 = 'data:image/jpeg;base64,'+ content.imgtn
											res({thumbnail_base64,originUrl})
										}catch(err){
											rej(err)
										}
									})
								},
								 */
								// showstatisticBar:false,
								allowEdit:false,
								isFormApp:true,  //数字表格
								// isShowPasteText:true,

								// isShowRightClickOfRoCol:false,
								// isMobile:true,
								// revocableQua:3,
								
								// noExcelWidthAndHeight:true,
								// showtoolbar:false,
								

								// isHideOfAddRow:true,


								
								// showtoolbar:false,
								// isMobile:true,
								// forceCalculation:true,
								// freezeAllowEdit:false,
								// allowEdit:false,
								// showsheetbarConfig:{
								// 	add: false, //新增sheet  
								// 	menu: true, //sheet管理菜单
								// 	sheet: true //sheet页显示
								// },
								// showsheetbar:false,
								// forceCalculation: true,
								// rowHeaderWidth:0,
								// columnHeaderHeight:0,
								cellRightClickConfig:{
									indicator:false
								},
								showGridLines:false,
								plugins: ['chart'],
								hook: {
									workbookCreateAfter(a){
										// setTimeout(()=>{
										// 	$("#luckysheetCellFormatRightClickMenu")[0].click()
										// })
										// luckysheet.setCellValue_pure(2,0,1111)
										// luckysheet.setCellValue_pure(0,2,{e:true})
									},
									// rangePasteAfter(range){
									// 	console.log(range,'粘贴后');
										
									// },
									// rangeValueUpdated(updateArr){
									// 	console.log(updateArr,'rangeValueUpdated');
									// },
									// cellUpdated(cell, postion, sheetFile, ctx, event){
									// 	console.log(cell,'cellUpdated');
									// },
									
									rangeValueUpdated(val){
										console.log('9999endddd',val);
									},
									rangeValueUpdateBefore(){
										console.log('8888');
									},
									cellUpdated(a,b,c,d){
										console.log('cellUpdateddd','-------');
										
										console.log(a,b,c,d);
									
									},
									cellDragStop: function (cell, postion, sheetFile, ctx, event) {
										// console.info(cell, postion, sheetFile, ctx, event);
									},
									rowTitleCellRenderBefore: function (rowNum, postion, ctx) {
										// console.log(rowNum);
									},
									rowTitleCellRenderAfter: function (rowNum, postion, ctx) {
										// console.log(ctx);
									},
									columnTitleCellRenderBefore: function (columnAbc, postion, ctx) {
										// console.log('99');
									},
									columnTitleCellRenderAfter: function (columnAbc, postion, ctx) {
										// console.log(postion);
									},
									cellRenderBefore: function (cell, postion, sheetFile, ctx) {
										// console.log(cell,postion,sheetFile,ctx);
									},
									cellRenderAfter: function (cell, postion, sheetFile, ctx) {

									},
									cellMousedownBefore: function (cell, postion, sheetFile, ctx) {

									},
									cellMousedown: function (cell, postion, sheetFile, ctx,which) {
											if(luckysheet.getFreezeAllowEdit() == false){
													luckysheet.changeAllowEdit(false)
													setTimeout(()=>{
															// 默认整张表是不可编辑的
															const ranveVal = luckysheet.getRangeValue()
															// 范围单元格只要有单元格的e不是true就整个不允许编辑
															let isAllowEdit = true
															ranveVal.forEach(arr=>{
																arr.forEach(cellItem=>{
																	if(cellItem?.e != true){
																		isAllowEdit = false
																		return
																	}
																})
															}) 
															
															luckysheet.changeAllowEdit(isAllowEdit)
															console.log('cellMouseDown',luckysheet.getStore().allowEdit);

													})
												}								
									},
								
									sheetMousemove: function (cell, postion, sheetFile, moveState, ctx) {
										// console.log(cell,postion,sheetFile,moveState,ctx);
									},
									sheetMouseup: function (cell, postion, sheetFile, moveState, ctx) {
										// console.log(cell,postion,sheetFile,moveState,ctx);
									},
									cellAllRenderBefore: function (data, sheetFile, ctx) {
										// console.info(data,sheetFile,ctx)
									},
									updated: function (operate) {
										
										console.log(operate,'updated...');
										
													// console.info('update',operate)		
										// console.log(operate,'9999999999');
									},
									// formulaCellUpdated(r,c,newCell){
									// 	// console.log(r,c,newV,'============');
									// },
									cellUpdateBefore: function (r, c, value, isRefresh) {
										// console.info('cellUpdateBefore',r,c,value,isRefresh)
										
									},

									sheetActivate: function (index, isPivotInitial, isNewSheet) {
										// console.info(index, isPivotInitial, isNewSheet)
									},
								
									rangeSelect: function (index, sheet) {
										// console.info(index, sheet)
									},
									commentInsertBefore: function (r, c) {
										// console.info(r, c)
									},
									commentInsertAfter: function (r, c, cell) {
										// console.info(r, c, cell)
									},
									commentDeleteBefore: function (r, c, cell) {
										// console.info(r, c, cell)
									},
									commentDeleteAfter: function (r, c, cell) {
										// console.info(r, c, cell)
									},
									commentUpdateBefore: function (r, c, value) {
										// console.info(r, c, value)
									},
									commentUpdateAfter: function (r, c, oldCell, newCell) {
										// console.info(r, c, oldCell, newCell)
									},
									cellEditBefore: function (range) {
										// luckysheet.changeAllowEdit(false)

									},

									rangePasteBefore: function (range, data) {
										// console.info('rangePasteBefore',range,data)
										// return false; //Can intercept paste
									},


								},
					}
			
				
						options.loading = {
							image: () => {
								return `<svg viewBox="25 25 50 50" class="circular">
					<circle cx="50" cy="50" r="20" fill="none"></circle>
					</svg>`
							},
							imageClass: "loadingAnimation"
						}
						// options.cellRightClickConfig = {
						// 	customs: [{
						// 		title: 'test',
						// 		onClick: function (clickEvent, event, params) {
						// 			console.log('function test click', clickEvent, event, params)
						// 		}
						// 	}]
						// }
						luckysheet.create(options);
					})


				}
			}
			// 配置请求
			// xhr.open('get', 'http://os-kf.gongqi.info/MIX/web/apps/gongqi.tool.onlineForm/file/openPurchFile?gongqiFileId=5a17a84aa9eb4211b8d241d867bc61a4')
			xhr.open('get', httpPath)


			xhr.setRequestHeader('Content-Type', 'application/json')
			xhr.setRequestHeader('token', token)

			// xhr.setRequestHeader('token', 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInByb2plY3QiOiJnb25ncWlfYm9vdF9AMjAyNSIsImlhdCI6MTY2NjI1NTE5NSwidXNlcm5hbWUiOiJhZG1pbiJ9.OQQYUKLc735s8BAi-O1csQvRNbpMZcD4jFxrQOkVAkk')
			// 发送请求
			xhr.send()
		}

		// // 方式1 

// let httpPath='http://os-kf.gongqi.info/MIX/web/apps/gongqi.tool.onlineForm/file/openPurchFile?gongqiFileId=9e3c6a9d6d5441be96d9cad42678a50b'
// let token='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInByb2plY3QiOiJnb25ncWlfYm9vdF9AMjAyNSIsImlhdCI6MTY5MTcxNDIyNiwidXNlcm5hbWUiOiJhZG1pbiJ9.6Xw_-JMBCEtstd3CpVbCzGAVeHOKcVsMc1oWxRUuNOw'

// let httpPath='http://124.70.141.129:50000/MIX/web/apps/gongqi.tool.onlineForm/file/openPurchFile?gongqiFileId=e3c6f7daef4b441a899609975afb53a4'
// let token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInByb2plY3QiOiJnb25ncWlfYm9vdF9AMjAyNSIsImlhdCI6MTY5OTQyNjQwOCwidXNlcm5hbWUiOiJhZG1pbiJ9.qZ-zMtb_2FyS0niJ_xUluttqjXsPEZG-SMbrPp8FYR4'

// let httpPath='http://os-kf.gongqi.info/MIX/web/apps/gongqi.tool.onlineForm/file/openPurchFile?gongqiFileId=d128cc1890464664a53431bb30da24f3'
// let token= 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInByb2plY3QiOiJnb25ncWlfYm9vdF9AMjAyNSIsImlhdCI6MTY5NzA4ODA2NiwidXNlcm5hbWUiOiJhZG1pbiJ9.V-U1ZHwx3kNPVspm_XvoV7WlYbm_Ru6QRlyHSF0QR8I'

// let httpPath='http://os-kf.gongqi.info/MIX/web/apps/gongqi.tool.onlineForm/file/openPurchFile?gongqiFileId=9fd7e20793fb4e66ab5317eeb0a19558'
// let token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInByb2plY3QiOiJnb25ncWlfYm9vdF9AMjAyNSIsImlhdCI6MTY5ODkxNTE4NywidXNlcm5hbWUiOiJhZG1pbiJ9.A9uGYljzmwvYcwcFTl-LV6yG6XTDejhHxEy---5ev8I'


// let httpPath='http://os-kf.gongqi.info/MIX/web/apps/gongqi.tool.onlineForm/file/openPurchFile?gongqiFileId=640471d909b245f2bcfee2a163792404'
// let token='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInByb2plY3QiOiJnb25ncWlfYm9vdF9AMjAyNSIsImlhdCI6MTY5ODM5NDkxMCwidXNlcm5hbWUiOiJhZG1pbiJ9.XHNtIT23P2BlVBoGcL_Y_UiYYvE1JeIjkexGw4A2CMQ'

// let httpPath='http://localhost:3000/assets/newD/newFile.txt'
// let token=''

// let httpPath='http://218.4.82.164:11433/MIX/web/apps/gongqi.tool.onlineForm/file/openPurchFile?gongqiFileId=a1eb400f893947c99201330b2f3fbf90'
// let token='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInByb2plY3QiOiJnb25ncWlfYm9vdF9AMjAyNSIsImlhdCI6MTY5NzAwODIyOSwidXNlcm5hbWUiOiJhZG1pbiJ9.but6FDpIHK9s32DhOqaAIuHNe3BCwgq8LK8uisYair8'

// let httpPath='http://os-kf.gongqi.info/MIX/web/apps/gongqi.tool.onlineForm/file/openPurchFile?gongqiFileId=d128cc1890464664a53431bb30da24f3'
// let httpPath='http://124.70.141.129:50000/MIX/web/apps/gongqi.tool.onlineForm/file/openPurchFile?gongqiFileId=b806047ecee84f398af9b3e73bbfd657'
// let httpPath='http://124.70.141.129:50000/MIX/web/apps/gongqi.tool.onlineForm/file/openPurchFile?gongqiFileId=a4d7d1d124b04a9ba19900775a6a7d4d'

// let httpPath = 'http://os-kf.gongqi.info/MIX/web/apps/gongqi.tool.onlineForm/file/openPurchFile?gongqiFileId=d97abd2f18574001839934ab4a357e16'
// let httpPath = 'http://os-kf.gongqi.info/MIX/web/apps/gongqi.tool.onlineForm/file/openPurchFile?gongqiFileId=3d95e59c680e4d72ac130e9323c1074e'
let httpPath = 'xlg/MIX/web/apps/gongqi.tool.onlineForm/file/openPurchFile?gongqiFileId=0a1d51c478ae47569bdb1afe857304ac'


// let httpPath ='http://localhost:3000/assets/newD/下拉.txt'

// let httpPath='http://os-kf.gongqi.info/MIX/web/apps/gongqi.tool.onlineForm/file/openPurchFile?gongqiFileId=9e3c6a9d6d5441be96d9cad42678a50b'
let token= 'a39cb8ec-734b-418c-bf09-d48706e00abf'



		foo(httpPath, token)



		// 方式2 联调
		function handleMessage(event) {
			const data = event.data;
			console.log(data, '消息嘻嘻嘻=========');
			windowXlgData(data.xlg)
		}


		function mounted() {
			window.addEventListener('message', this.handleMessage);
		}

		// mounted()

		function windowXlgData(xlg) {

			let xlgJson = xlg
			// console.log(window.parent.window.xlgData);

			// if (window.parent.window.xlgData) {
			// 	xlgJson = window.parent.window.xlgData
			// }
			console.log(xlgJson, '-=-=');

			let sheetCell222 = xlgJson.content
			$(function () {
				// According to the browser language
				var lang = luckysheetDemoUtil.language() === 'zh' ? 'zh' : 'en';
				var isShare = luckysheetDemoUtil.getRequest().share; // '?share=1' opens the collaborative editing mode
				var gridKey = luckysheetDemoUtil.getRequest().gridKey; // workbook id for collaborative editing, or directly define here
				var options = null;


				if (isShare || gridKey) {
					// http://localhost:3000/?gridKey=12eyy789-kk45ofid-23737245
					if (!gridKey) {
						alert('If gridKey is not provided in the address bar, please add it in the source code')
					}
					options = {
						container: "luckysheet",
						// forceCalculation: true,
						lang: lang,
						allowUpdate: false,
						// allowEdit: false,
						updateImageUrl: location.origin + "/luckysheet/api/updateImg",
						updateUrl: "ws://" + location.host + "/luckysheet/websocket/luckysheet",
						gridKey: gridKey,
						loadUrl: location.origin + "/luckysheet/api/load",
						loadSheetUrl: location.origin + "/luckysheet/api/loadsheet"
					}
					console.log('options.ws地址：PP', options.updateUrl);

				} else {
					// http://localhost:3000/ 
					options = {
						// data: [sheetCell,sheetFormula,sheetConditionFormat,sheetSparkline,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable,sheetChart,sheetPicture,sheetDataVerification,...sheetCell222],
						data: [...sheetCell222],
						container: 'luckysheet',
						lang: lang,
						// pager: {
						// 	pageIndex: 1,
						// 	pageSize: 10,
						// 	total: 50,
						// 	selectOption: [10, 20]
						// },
						forceCalculation: true,

						plugins: ['chart'],
						fontList: [
							{
								"fontName": "HanaleiFill",
								"url": "./assets/iconfont/HanaleiFill-Regular.ttf"
							},
							{
								"fontName": "Anton",
								"url": "./assets/iconfont/Anton-Regular.ttf"
							},
							{
								"fontName": "Pacifico",
								"url": "./assets/iconfont/Pacifico-Regular.ttf"
							}
						],
						hook: {
							cellDragStop: function (cell, postion, sheetFile, ctx, event) {
								// console.info(cell, postion, sheetFile, ctx, event);
							},
							rowTitleCellRenderBefore: function (rowNum, postion, ctx) {
								// console.log(rowNum);
							},
							rowTitleCellRenderAfter: function (rowNum, postion, ctx) {
								// console.log(ctx);
							},
							columnTitleCellRenderBefore: function (columnAbc, postion, ctx) {
								// console.log(columnAbc,'999');
								// debugger
							},
							columnTitleCellRenderAfter: function (columnAbc, postion, ctx) {
								// console.log(postion);
							},
							cellRenderBefore: function (cell, postion, sheetFile, ctx) {
								// console.log(cell,postion,sheetFile,ctx);
							},
							cellRenderAfter: function (cell, postion, sheetFile, ctx) {
								// console.log(postion);
							},
							cellMousedownBefore: function (cell, postion, sheetFile, ctx) {
								// console.log(postion);
							},
							cellMousedown: function (cell, postion, sheetFile, ctx) {
								// console.log(sheetFile);
							},
							sheetMousemove: function (cell, postion, sheetFile, moveState, ctx) {
								// console.log(cell,postion,sheetFile,moveState,ctx);
							},
							sheetMouseup: function (cell, postion, sheetFile, moveState, ctx) {
								// console.log(cell,postion,sheetFile,moveState,ctx);
							},
							cellAllRenderBefore: function (data, sheetFile, ctx) {
								// console.info(data,sheetFile,ctx)
							},
							updated: function (operate) {
					
							},
							cellUpdateBefore: function (r, c, value, isRefresh) {
								// console.info('cellUpdateBefore',r,c,value,isRefresh)
							},
							cellUpdated: function (r, c, oldValue, newValue, isRefresh) {
								// console.info('cellUpdated',r,c,oldValue, newValue, isRefresh)


							},
							sheetActivate: function (index, isPivotInitial, isNewSheet) {
								// console.info(index, isPivotInitial, isNewSheet)
							},
							rangeSelect: function (index, sheet) {
								// console.info(index, sheet)
							},
							commentInsertBefore: function (r, c) {
								// console.info(r, c)
							},
							commentInsertAfter: function (r, c, cell) {
								// console.info(r, c, cell)
							},
							commentDeleteBefore: function (r, c, cell) {
								// console.info(r, c, cell)
							},
							commentDeleteAfter: function (r, c, cell) {
								// console.info(r, c, cell)
							},
							commentUpdateBefore: function (r, c, value) {
								// console.info(r, c, value)
							},
							commentUpdateAfter: function (r, c, oldCell, newCell) {
								// console.info(r, c, oldCell, newCell)
							},
							cellEditBefore: function (range) {

								// console.info(range)
							},
	
							rangePasteBefore: function (range, data) {
								// console.info('rangePasteBefore',range,data)
								// return false; //Can intercept paste
							},


						},


					}
				}





				options.loading = {
					image: () => {
						return `<svg viewBox="25 25 50 50" class="circular">
			<circle cx="50" cy="50" r="20" fill="none"></circle>
			</svg>`
					},
					imageClass: "loadingAnimation"
				}
				options.cellRightClickConfig = {
					customs: [{
						title: 'test',
						onClick: function (clickEvent, event, params) {
							console.log('function test click', clickEvent, event, params)
						}
					}]
				}
				luckysheet.create(options);
			})


		}




	</script>
	<style>
		/* 自定义loading演示样式 */
		@keyframes loading-rotate {
			0% {
				transform: rotate(0deg);
			}

			100% {
				transform: rotate(360deg);
			}
		}

		@keyframes loading-dash {
			0% {
				stroke-dasharray: 1, 200;
				stroke-dashoffset: 0;
			}

			50% {
				stroke-dasharray: 90, 150;
				stroke-dashoffset: -40px;
			}

			100% {
				stroke-dasharray: 90, 150;
				stroke-dashoffset: -120px;
			}
		}

		.loadingAnimation {
			width: 3em;
			height: 3em;
			animation: loading-rotate 2s linear infinite;
		}

		.loadingAnimation circle {
			animation: loading-dash 1.5s ease-in-out infinite;
			stroke-dasharray: 90, 150;
			stroke-dashoffset: 0;
			stroke-width: 2;
			stroke: currentColor;
			stroke-linecap: round;
		}

	</style>
</body>

</html>
